package com.lzq.springboot_lzq.pojo.dto;

import com.lzq.springboot_lzq.pojo.Dept;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.NotBlank;
import org.hibernate.validator.constraints.Length;


/**
 * 用户数据传输对象（DTO），用于在不同层之间传输用户数据。
 * 该类通常不包含业务逻辑，仅用于封装和传递数据。
 */
public class UserDto {

    private Integer id;
    @NotBlank(message = "用户名不能为空")  //增加数据校验
    private String name;
    @NotBlank(message = "密码不能为空")
    @Length(min = 6,max = 20,message = "密码长度应在6-20位之间")
    private String password;
    @Email(message = "邮箱格式不正确")
    private String email;
    private Dept deptId;

    public Integer getId() {
        return id;
    }
    public void setId(Integer id) {
        this.id = id;
    }
    public String getName() {
        return name;
    }
    public void setName(String name) {
        this.name = name;
    }
    public String getPassword() {
        return password;
    }
    public void setPassword(String password) {
        this.password = password;
    }
    public String getEmail() {
        return email;
    }
    public void setEmail(String email) {
        this.email = email;
    }
    public Dept getDeptId() {
        return deptId;
    }
    public void setDeptId(Dept deptId) {
        this.deptId = deptId;
    }

    @Override
    public String toString() {
        return "User{" +
                ", name='" + name + '\'' +
                ", password='" + password + '\'' +
                ", email='" + email + '\'' +
                ", deptId=" + deptId +
                '}';}
}
